/* eslint-disable @typescript-eslint/no-unused-vars */
import { createRouter, createWebHashHistory, RouteRecordRaw } from 'vue-router';
import Layout from '../layouts/index.vue';
import common from './common';
import shared from './modules/shared';
import { createRouterGuards } from './router-guards';
import { errorRoutes, notFound } from './modules/error';
import { App } from 'vue';

export const routes: Array<RouteRecordRaw> = [
  {
    path: '/',
    name: 'Layout',
    component: Layout,
    redirect: '/welcome',
    meta: {
      title: '首页'
    },
    children: [...common]
  },
  ...shared
  // errorRoutes
];

const router = createRouter({
  history: createWebHashHistory(),
  routes
});

export function setupRouter(app: App) {
  app.use(router);
  // 创建路由守卫
  createRouterGuards(router);
}
export default router;
